/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package assignment_cp3120.registeruser;

import assignment_cp3120.dataObjects.User;

/**
 *
 * @author Administrator
 */
public class RegisterUserModel {
    /**
     * Commands for buttons: submit
     */
    public final String SUBMIT = "submit";
    /**
     * Commands for buttons: cancel
     */
    public final String CANCEL = "cancel";

    //array possitions for data
    public final int FIRSTNAME_POS  = 0;
    public final int LASTNAME_POS   = 1;
    
    public final int DOB_DAY_POS    = 0;
    public final int DOB_MONTH_POS  = 1;
    public final int DOB_YEAR_POS   = 2;
    
    public final int ADDRESS_POS    = 0;
    public final int SUBURB_POS     = 1;
    public final int STATE_POS      = 2;
    public final int POSTCODE_POS   = 3;
    
    public final int USERNAME_POS   = 0;
    public final int PASSWORD_POS   = 1;
    public final int CONFIRM_POS    = 2;
    
    
    private User newUser;

    private String confirmPassword;
    
    /**
     * Default constructor. Creates a new user
     */
    public RegisterUserModel(){
        newUser = new User();
    }
    /**
     * Checks if the username is valid
     * @return
     * If result, true if valid
     */
    public boolean isUniqueUsername() {
        //MysqlUserDAO         
        
        return true;
    }
    /**
     * Prints the data stored in the user
     */
    public void print(){
        System.out.println("Name: " + getFirstName() + " " + getLastName());
        System.out.println("DOB: " + getDOB());
        System.out.println("Adrress: " + getAddress()  + ", " + getSuburb() + ", " + getState() + ", " + getPostcode());
        System.out.println("Username: " + getUsername());
        System.out.println("Password: " + getPassword());
        System.out.println("ConfirmP: " + getConfirmPassword());
    }
    
    /**
     * Get user
     * @return
     * user
     */
    public User getUser(){return newUser;}
    
    /**
     * Get fristname
     * @return
     * fristname
     */
    public String getFirstName() {return newUser.getFirstname();}
    /**
     * Get lastname
     * @return
     * lastname
     */
    public String getLastName() {return newUser.getLastname();}
    
    /**
     * Get DOB
     * @return
     * DOB
     */
    public String getDOB(){return newUser.getDOB();}
    
    /**
     * Get address
     * @return
     * address
     */
    public String getAddress() {return newUser.getAddress();}    
    /**
     * Get suburb
     * @return
     * suburb
     */
    public String getSuburb() {return newUser.getSuburb();}
    /**
     * Get state
     * @return
     * state
     */
    public String getState() {return newUser.getState();}
    /**
     * Get postcode
     * @return
     * postcode
     */
    public String getPostcode() {return newUser.getPostcode();}    

    /**
     * Get username
     * @return
     * username
     */
    public String getUsername() {return newUser.getUsername();}
    /**
     * Get password
     * @return
     * password
     */
    public String getPassword() {return newUser.getPassword();}
    /**
     * Get confirmpass
     * @return
     * confirmpassword
     */
    public String getConfirmPassword() {return confirmPassword;}
    

    /**
     * Set user
     * @param user
     */
    public void setUser(User user){newUser = user;}
    
    /**
     * Set firstname
     * @param firstName
     */
    public void setFirstName(String firstName) {newUser.setFirstname(firstName);}
    /**
     * Set lastname
     * @param lastName
     */
    public void setLastName(String lastName) {newUser.setLastname(lastName);}    
    
    /**
     * Set DOB
     * @param DOB
     */
    public void setDOB(String DOB) {newUser.setDOB(DOB);}
    
    /**
     * Set address
     * @param address
     */
    public void setAddress(String address) {newUser.setAddress(address);}
    /**
     * Set suburb
     * @param suburb
     */
    public void setSuburb(String suburb) {newUser.setSuburb(suburb);}
    /**
     * Set state
     * @param state
     */
    public void setState(String state) {newUser.setState(state);}
    /**
     * Set postcode
     * @param postcode
     */
    public void setPostcode(String postcode) {newUser.setPostcode(postcode);}    

    /**
     * Set username
     * @param username
     */
    public void setUsername(String username) {newUser.setUsername(username);}
    /**
     * Set password
     * @param password
     */
    public void setPassword(String password) {newUser.setPassword(password);}
    /**
     * Set confirmpassword
     * @param confirmPassword
     */
    public void setConfirmPassword(String confirmPassword) {this.confirmPassword = confirmPassword;}
    
    /**
     * Check that the password and comfirm password is the same
     * @return
     * return true if the are the same
     */
    public boolean isPassConfirmEqual(){
        return newUser.getPassword().equals(confirmPassword);
    }
}
